# -*- coding: utf-8 -*-

# @Project : DDT_FrameWork
# @Author  : Mr.Deng
# @Time    : 2021/9/16 23:45

"""
切入、切出页面中的frame框架
"""

from common.seleniumLibrary.base import Base
from common.tools.decorator import error_collection


class Frame(Base):

    @error_collection
    def switch_into_frame(self, elementPath: tuple):
        """
        切换进入页面frame框架
        :param elementPath:
        :return:
        """
        self.wait_frame_to_be_available(elementPath)
        self.Log.info(f"切换进入frame框架：{elementPath}")

    @error_collection
    def switch_out_frame(self):
        """
        切换出页面frame框架
        :return:
        """
        self.driver.switch_to.default_content()
        self.Log.info(f"切换出去frame框架")
